//
//  AppointmentVipInfoView.m
//  WeiYiMei
//
//  Created by 李叶夫 on 2019/4/23.
//  Copyright © 2019年 liyefu. All rights reserved.
//

#import "AppointmentVipInfoView.h"
#import "UIImage+Color.h"

@interface AppointmentVipInfoView ()

@property (nonatomic, strong) UIImageView *line;
@property (nonatomic, strong) UILabel *vipTitle;
@property (nonatomic, strong) UILabel *vipCodeLab;

@property (nonatomic, strong) UILabel *vipTelLab;


@end

@implementation AppointmentVipInfoView

- (void)setupSubViews
{
    self.line = [[UIImageView alloc] init];
    self.line.image = [UIImage gradientImageWithColorArray:@[(id)kColorGradientBegin.CGColor,(id)kColorGradientEnd.CGColor] beginPoint:CGPointMake(0, 0) endPoint:CGPointMake(0, kWidth(15)) rect:CGRectMake(0, 0, 2, kWidth(15))];
    [self addSubview:self.line];
    
    self.vipTitle = [[UILabel alloc] init];
    self.vipTitle.font = [UIFont boldSystemFontOfSize:15];
    self.vipTitle.textColor = kColor333333;
    self.vipTitle.text = @"会员信息";
    [self addSubview:self.vipTitle];
    
    self.vipCodeLab = [[UILabel alloc] init];
    self.vipCodeLab.font = [UIFont systemFontOfSize:14];
    self.vipCodeLab.textColor = kColor666666;
    self.vipCodeLab.text = @"会员卡号：";
    [self addSubview:self.vipCodeLab];
    
    self.vipCode = [[UILabel alloc] init];
    self.vipCode.font = [UIFont systemFontOfSize:14];
    self.vipCode.textColor = kColor666666;
    self.vipCode.numberOfLines = 0;
    [self addSubview:self.vipCode];
    
    self.vipTelLab = [[UILabel alloc] init];
    self.vipTelLab.font = [UIFont systemFontOfSize:14];
    self.vipTelLab.textColor = kColor666666;
    self.vipTelLab.text = @"会员电话：";
    [self addSubview:self.vipTelLab];
    
    self.vipTel = [[UILabel alloc] init];
    self.vipTel.font = [UIFont systemFontOfSize:14];
    self.vipTel.textColor = kColor666666;
    self.vipTel.numberOfLines = 0;
    [self addSubview:self.vipTel];
}

- (void)setupConstraints
{
    [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(kWidth(16));
        make.width.equalTo(@(kWidth(2)));
        make.height.equalTo(@(kWidth(15)));
        
        make.centerY.equalTo(self.vipTitle);
    }];
    
    [self.vipTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(kWidth(20));
        make.left.equalTo(self.line.mas_right).offset(kWidth(5));
    }];
    
    [self.vipCodeLab setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
    [self.vipCodeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.vipTitle.mas_bottom).offset(kWidth(16));
        make.left.equalTo(self.line);
    }];
    
    [self.vipCode setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
    [self.vipCode mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.vipCodeLab);
        make.left.equalTo(self.vipCodeLab.mas_right);
        make.right.lessThanOrEqualTo(self).offset(-kWidth(16));
    }];
    
    [self.vipTelLab setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
    [self.vipTelLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.line);
        make.top.equalTo(self.vipCode.mas_bottom).offset(kWidth(12));
    }];
    
    [self.vipTel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
    [self.vipTel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.vipTelLab);
        make.left.equalTo(self.vipTelLab.mas_right);
        make.right.lessThanOrEqualTo(self).offset(-kWidth(16));
        make.bottom.equalTo(self).offset(-kWidth(30));
    }];
}

@end
